<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class hutang extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('mtransaksi_jual');
    }

    public function index() {
        $data['title'] = 'Hutang';
        $data['page'] = 'public/retail/vhutang';

//        $data['arr'] = json_encode($arr);
//        $data['tahun'] = date('Y');
//        $data['name'] = 'All Retail';
//        $data['bulan'] = "'9-jan','10-jan','11-jan'";


        $transaksi = $this->mtransaksi_jual->get_chart_per_tanggal(date('m'), date('Y'));
        $bln = "";
        $total = "";

        $arr = array();
        $i = 0;
        foreach ($transaksi->result() as $row) {
            $bln = $bln . "','" . $row->tglbln;
            $arr[$i] = $row->total;
            $i++;
        }
        $bln = substr($bln, 2) . "'";
        $total = substr($total, 1);
        $data['name'] = 'All Retail';
        $data['bulan'] = $bln;
        $data['tahun'] = date('Y');
        $data['total'] = str_replace('"', '', json_encode($arr));

        $this->load->view('public/retail/index', $data);
    }

}

/* End of file hutang.php */
/* Location: ./application/controllers/hutang.php */